package ui.swing.model;

import java.util.List;

import javax.swing.table.DefaultTableModel;

import com.stock.dao.Stockinfo;

public class StockInfoModel extends DefaultTableModel {
	private static final long serialVersionUID = 8890622870907657731L;
	protected String[] col = new String[]{"code","name","shortname","industry","sinaindustry","area"};
	public StockInfoModel(List list) {
		Object[][] datas = new Object[list.size()][col.length];
		for (int i = 0; i < list.size(); i++) {
			Stockinfo stockinfo = (Stockinfo)list.get(i);
			datas[i][0] = stockinfo.getNumber();
			datas[i][1] = stockinfo.getName();
			datas[i][2] = stockinfo.getShortname();
			datas[i][3] = stockinfo.getIndustry();
			datas[i][4] = stockinfo.getSinaIndustry();
			datas[i][5] = stockinfo.getArea();
		}
		setDataVector(datas, col);
	}
}
